<template>
	<view class="flex-between-center location-item" :class="custClass" :style="[custStyle]" @click="clickFun">
		<view class="content">
			<view class="start">
				<u-icon name="a-guiji-qidian"  :isShowIcon="false" color="#007AED"
					customPrefix="iconfontbike iconbike">
				</u-icon>
				<view class="text">{{start}}</view>
			</view>
			<view class="start-desc mt10" style="margin-left: 18px;" v-if="startDesc">{{startDesc}}</view>
			<view class="end">
				<u-icon name="a-guiji-zhongdian" size="15" color="#ED1E1E" :isShowIcon="false" customPrefix="iconfontbike iconbike">
				</u-icon>
				<view class="text">{{end}}</view>
			</view>
			<view class="end-desc mt10" style="margin-left: 18px;" v-if="endDesc">{{endDesc}}</view>
		</view>
		<u-icon v-if="arrow" name="youjiantou" color="#999999" size="16" :isShowIcon="false" customPrefix="iconfontbike iconbike"></u-icon>
		<slot name="content"></slot>
	</view>
</template>

<script>
	import UIcon from "../../uview-ui/components/u-icon/u-icon";
	import {
		throttle
	} from '@/utils/utils.js'
	
	export default {
		name: "locate-start-end",
		components: {
			UIcon
		},
		props: {
			start: {
				type: String,
				default: ''
			},

			end: {
				type: String,
				default: ''
			},

			startDesc: {
				type: String,
				default: ''
			},

			endDesc: {
				type: String,
				default: ''
			},

			arrow: {
				type: Boolean,
				default: true
			},

			custStyle: {
				type: Object,
				default () {
					return {}
				}
			},

			custClass: {
				type: String | Array,
				default () {
					return []
				},
			},
		},
		methods:{
			clickFun:throttle(function(){
				this.$emit('click')
			})
		}
	}
</script>

<style lang="scss" scoped>
	.location-item {
		background: #EBEFF7;
		width: 647rpx;
		border-radius: 20rpx;
		padding: 20rpx;
		box-sizing: border-box;

		//margin-top: 30rpx;
		.start,
		.end {
			display: flex;
			justify-content: start;
			align-items: center;
			// max-width: 325rpx;
			// max-height: 32rpx;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;

			.text {
				margin-left: 10rpx;
				//color: #666666;
				font-size: 24rpx;
			}
		}

		.end {
			margin-top: 38rpx;
		}

		.start-desc,
		.end-desc {
			font-size: 20rpx;
			color: #999999;
			// max-width: 325rpx;
			// max-height: 24rpx;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}
	}
</style>
